|
|
|
|
|
|
|
This means that, from this point on in the program, the data type ushort refers to an unsigned short variable. A typedef statement doesn't really do anything, it just allows you to create new names for common data types.2 |
|
|
|
|
|
|
|
|
Why should you comment these lines out instead of just deleting them? Because they provide crucial hints about what data type you will actually use for variables within structures and function parameters. If you see a parameter in a function in speed.h that is declared as a ushort, the typedef statement lets you know that it is, in fact, an unsigned short variable and thus will be a 16-bit Visual Basic integer in the VB declaration. |
|
|
|
|
|
|
|
|
Step 6:
Port the Structures and Functions |
|
|
|
|
|
|
|
|
I won't go into further details here on this process other than to refer you to the puzzles in Part I (after all, this whole book is about coming up with declarations for structures and functions). The only challenging function here is the cpuspeed function, which is discussed in Puzzle 29. |
|
|
|
 |
|
 |
|
|
2 Purists and most C/C++ programmers will immediately protest that the typedef command is, in fact, a very important statement that does quite a lot, specifically concerning enforcing type checking. But that fact is completely irrelevant to Visual Basic programmers, at least with regard to the porting process. So you see, I haven't completely taken leave of my senses. |
|
|
|
|
|